//
// parms_xml.h
// libprotea
// Tools Library for the Protea Project / Configuration XML Handling
// Copyright (C) 2003, 2004, 2005 eXegeSys, Inc.
// Copyright (C) 2008 Bruce A. James
//
// This program is part of the Protea Project.
//
// The Protea Project is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the 
// Free Software Foundation, either version 3 of the License, or (at your 
// option) any later version.
//
// The Protea Project is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program.  If not, see <http://www.gnu.org/licenses/>.
// 
// Please send correspondence to:
//
// theproteaproject@gmail.com
//

#ifndef __PROTEA_PARMS_H__
#define __PROTEA_PARMS_H__




// Forward declaration
namespace XERCES_CPP_NAMESPACE {
class DOMNode;
};



class __EXPORT XCDebugInfo {
public:
	int debug_type_filter;
	int debug_level_cutoff[ num_tc ];

	// Administrator email address
	char* admin_email;

	// SMTP host
	char* smtp_host;

	// Default printer
	char* printer;

	// FOP Location
	char* fop_location;
};


struct __EXPORT gcs_information : public XCDebugInfo {
	long port;
	char* machine;

	// Number of worker threads
	int worker_threads;

	// Authentication method
	int auth_method;

	// Authentication parameter
	char* auth_parameter;
};



// XCStartApp Class - Used to start applications in the system
class XCStartApp : public XCDebugInfo
{
public:
	XCStartApp();
	~XCStartApp();

	long number;
	char* name;
	char* machine;
	bool NETapp;

	XCStartApp* next;
};




// XCStartInterface Class - Used to start interfaces into the system
class XCStartInterface
{
public:
	XCStartInterface();
	~XCStartInterface();

	char* name;
	char* machine;
	long port;
	bool tracing;
	long worker_threads;
	XCStartInterface* next;
};



class __EXPORT parms_reader {
public:
	parms_reader();
	virtual ~parms_reader();

	bool LoadParms( const char* program_name = NULL );

	// startup parameters
	gcs_information gcs;
	XCStartApp* applist;
	XCStartInterface* interfacelist;

	// Optional flags
	bool want_interfaces;
	bool want_apps;

protected:
	void HandleAppList( XERCES_CPP_NAMESPACE::DOMNode* applistnode );
	void HandleInterfaceList( XERCES_CPP_NAMESPACE::DOMNode* intlistnode );
	void HandleProtea( XERCES_CPP_NAMESPACE::DOMNode* exnode );
	void HandleAuthentication( XERCES_CPP_NAMESPACE::DOMNode* exnode );
	void HandleSettings( XERCES_CPP_NAMESPACE::DOMNode* exnode, XCDebugInfo* currapp );

	void CheckDebugTags( XERCES_CPP_NAMESPACE::DOMNode* debug, XCDebugInfo* currapp );
};


__EXPORT long XCGetXMLPort();

#endif
